/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package medialibrary.persistence;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author user
 */
@Entity
@Table(name = "type")

public class Type implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 32)
    @Column(name = "typeName")
    private String typeName;
    @Basic(optional = false)
    @NotNull
    @Column(name = "borrowingTime")
    private int borrowingTime;
    @OneToMany(mappedBy = "typeName")
    private Collection<Oeuvre> oeuvreCollection;

    public Type() {
    }

    public Type(String typeName) {
        this.typeName = typeName;
    }

    public Type(String typeName, int borrowingTime) {
        this.typeName = typeName;
        this.borrowingTime = borrowingTime;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public int getBorrowingTime() {
        return borrowingTime;
    }

    public void setBorrowingTime(int borrowingTime) {
        this.borrowingTime = borrowingTime;
    }

    public Collection<Oeuvre> getOeuvreCollection() {
        return oeuvreCollection;
    }

    public void setOeuvreCollection(Collection<Oeuvre> oeuvreCollection) {
        this.oeuvreCollection = oeuvreCollection;
    }

    public String toString() {
        return typeName;
    }
    
}
